
<?php
require_once('page_base_jectly.php');

/*
 * sub classes of page_base_jectly will include only the changes from index_2;
 */
class newProject extends page_base_jectly {

	protected $contents_html='<div class=\'center\'>This is a project page.</div>';
	protected $id;//project_id
	protected $ProjectFile;
	protected $lblMessage;
	protected $btnButton;
	protected $btnSave;
	public $button_confirm;
	protected $test;
	protected $container;
	protected $btnMore;
	protected $btnAll;
	protected $lblAll;
	protected $intCount;
	public $txtTitle;
	public $lstProjectTypeObject;
	public $txtDescription;
	public $fileUpload;
	public $lstBudgetTypeObject;
	public $chkHideSearchEngine;
	public $lstTotalProjectdayTypeObject;
	public $chkAgreementCheck;
	public $error_message;
	public $bool_error=false;
	public $bool_permitted=false;
	     public $bool_message_exist=false;
	     public $btnBackStep;
	     public $btnSubmitProject;
	     public $btnProjectPage;
	     public $categoryid;
	     public $project;
	     public $subcategoryid;
	     public $objUser;
	     public $tmp;
	  
	
	public $bool_confirming=1;
	public $str_confirming_text='Are you sure to do this?<br /><br />';
        public $str_message;
        public $str_permission_error_text='no permission';





	function __construct() {
		parent::__construct();
		$this->bool_main_menu_on=true;
		$this->bool_main_logo_on=true;
		$this->bool_search_tab_on=false;
		$this->bool_breadcrumb_on=false;
		$this->bool_main_3boxes_on=false;
		$this->bool_search_result_within_page_on=false;
		$this->bool_account_menu_on=false;
		$this->bool_contents_area_on=true;
	}

	protected function Form_Create() {
		 

		//parent::Form_Create();

		QApplication::ExecuteJavaScript('document.forms[0].encoding = "multipart/form-data";');

		$this->panel_search_tab_Create();
		$this->panel_menubar_Create();
		$this->txtDescription_Create();
		$this->lstBudgetTypeObject_Create();
		$this->lstTotalProjectdayTypeObject_Create();
		$this->chkAgreementCheck_Create();

		 


		if($this->bool_logined())
		{
			$this->pnl_mebubar->hide_all_controls();
		}

		if(isset($this->selected_category_index_string) && is_numeric($this->selected_category_index_string))
		{
			$this->set_index_listbox_search_project(intval($this->selected_category_index_string));
		}


		 
		$this->textbox_Title_Create();
		$this->lstProjectTypeObject_Create();
		$this->chkHideSearchEngine_Create();

		/*-------------BtnSave(Confirm)--------------*///Begin
		
		$this->btnSave = new QButton($this);
		$this->btnSave->Text = QApplication::Translate('Save');
		$this->btnSave->AddAction(new QClickEvent(), new QServerAction('btnSave_Click'));
		//$this->btnSave->CausesValidation = true;
		//BtnSave -----End-----
		/*---------------------btnBackStep---------------------------*/
		$this->btnBackStep = new QButton($this);
		$this->btnBackStep ->Text = QApplication::Translate('Return to Step 1');
		$this->btnBackStep ->AddAction(new QClickEvent(), new QServerAction('btnBackStep_Click'));
		$this->btnBackStep ->CausesValidation = true;
		//btnBackStep -----End-----
		
		/*---------------------btnSubmitProject---------------------------*/
		$this->btnSubmitProject = new QButton($this);
		$this->btnSubmitProject ->Text = QApplication::Translate('Submit Project');
		$this->btnSubmitProject ->AddAction(new QClickEvent(), new QServerAction('btnSubmitProject_Click'));
		$this->btnSubmitProject ->CausesValidation = true;
		//btnSubmitProject -----End-----
		
		/*---------------------btnProjectPage---------------------------*/
		$this->btnProjectPage = new QButton($this);
		$this->btnProjectPage ->Text = QApplication::Translate('Go to the project page');
		$this->btnProjectPage ->AddAction(new QClickEvent(), new QServerAction('btnProjectPage_Click'));
		$this->btnProjectPage ->CausesValidation = true;
		//BtnSave -----End-----
		
		
			
		/*-----------------FileUpload------------------*///Begin
		$this->ProjectFile = new QFileControl($this);

		//$this->ProjectFile->TemporaryUploadPath =__ProjectFileUpload__;
		$_SESSION['newProject']['FilePath']=__ProjectFileUpload__;
		//$this->ProjectFile->ClickToView=false;
		$this->ProjectFile->CssClass = 'file_asset';
		//$this->ProjectFile->imgFileIcon->CssClass = 'file_asset_icon';
		$this->lblMessage = new QLabel($this);
		$this->lblMessage->Text = 'Click to Upload the File.';
		$this->btnButton = new QButton($this);
		$this->btnButton->Text = 'Upload';
		$this->btnButton->AddAction(new QClickEvent(), new QServerAction('btnButton_Click'));
		$this->btnButton->CausesValidation = false;
		//FileUpload-----END------
		//------------------Multiupload Form---------------//Begin
		$intCount=1;
		$this->container=new QPanel($this);
		$this->container->AutoRenderChildren=true;
		$this->lblAll = new QLabel($this->container);
		$this->btnMoreClick();
		$this->btnMore = new QButton($this);
		$this->btnMore->Text='More';
		$this->btnMore->AddAction(new QClickEvent(),new QServerAction('btnMoreClick'));
		$this->btnAll = new QButton($this);
		$this->btnAll->Text='Upload Files';
		$this->btnAll->AddAction(new QClickEvent(),new QServerAction('btnuploadClick'));
		//

		//

	}
	protected function btnMoreClick() {
		$this->intCount=$this->intCount+1;
		$this->tmp=new QFileControl($this->container);
		//$this->tmp->TemporaryUploadPath =__ProjectFileUpload__;
		$this->tmp->SetCustomStyle('Width','50%');
		
		
		
		 
	}

	protected function btnuploadClick() {
		$allchild=$this->GetChildControls($this->container);
		foreach ($allchild as $ac) {
			$this->lblAll->Text = $this->lblAll->Text.'-'.$ac->Name;
		}
		 copy($this->tmp->File, __ProjectFileUpload__.'/'. $this->tmp->FileName);
	}
	public function textbox_Title_Create($strControlId = null) {
		$this->txtTitle = new QTextBox($this);
		$this->txtTitle->Name = QApplication::Translate('Title');
			

		return $this->txtTitle;
	}
	public function lstProjectTypeObject_Create($strControlId = null) {
		$this->lstProjectTypeObject = new QRadioButtonList($this);
		$this->lstProjectTypeObject->Name = QApplication::Translate('Project Type');

		$this->lstProjectTypeObject->RepeatColumns=2;
		$this->lstProjectTypeObject->AddItem('Spec based project','spec based project');
		$this->lstProjectTypeObject->AddItem('Long term relationship','Long term relationship');


			
		return $this->lstProjectTypeObject;
	}
	public function txtDescription_Create($strControlId = null) {
		$this->txtDescription = new QTextBox($this);
		$this->txtDescription->Name = QApplication::Translate('Description');
			
		$this->txtDescription->Rows=10;
		$this->txtDescription->Columns=60;
		$this->txtDescription->TextMode = QTextMode::MultiLine;
		return $this->txtDescription;
	}
	public function lstBudgetTypeObject_Create($strControlId = null) {
		$this->lstBudgetTypeObject = new QRadioButtonList($this);
		$this->lstBudgetTypeObject->Name = QApplication::Translate('Budget Range');
			
		$this->lstBudgetTypeObject->RepeatColumns=8;
		$this->lstBudgetTypeObject->AddItem('$30-$100','0');
		$this->lstBudgetTypeObject->AddItem('$100-$300','1');
		$this->lstBudgetTypeObject->AddItem('$300-$500','2');
		$this->lstBudgetTypeObject->AddItem('$500-$1000','3');
		$this->lstBudgetTypeObject->AddItem('$1000-$3000','4');
		$this->lstBudgetTypeObject->AddItem('$3000-$5000','5');
		$this->lstBudgetTypeObject->AddItem('$5000-$7000','7');
		$this->lstBudgetTypeObject->AddItem('$7000-$10000','8');
		$this->lstBudgetTypeObject->AddItem('$10000-$15000','9');
		$this->lstBudgetTypeObject->AddItem('$15000-$20000','10');
		$this->lstBudgetTypeObject->AddItem('$20000-$25000','11');
		$this->lstBudgetTypeObject->AddItem('$25000-$35000','12');
		$this->lstBudgetTypeObject->AddItem('$35000-$50000','13');
		$this->lstBudgetTypeObject->AddItem('>$50000','14');
		$this->lstBudgetTypeObject->AddItem('Very Small','15');
		$this->lstBudgetTypeObject->AddItem('Small','16');
		$this->lstBudgetTypeObject->AddItem('Medium','17');
		$this->lstBudgetTypeObject->AddItem('Large','18');
		$this->lstBudgetTypeObject->AddItem('Very Large','19');
		
			

			
	}
	public function lstTotalProjectdayTypeObject_Create($strControlId = null) {
		$this->lstTotalProjectdayTypeObject = new QRadioButtonList($this);
		$this->lstTotalProjectdayTypeObject->Name = QApplication::Translate('Total Project day ');

		$this->lstTotalProjectdayTypeObject->RepeatColumns=8;
		$this->lstTotalProjectdayTypeObject->AddItem('5 Days','0');
		$this->lstTotalProjectdayTypeObject->AddItem('7 Days','1');
		$this->lstTotalProjectdayTypeObject->AddItem('12 Days','2');
		$this->lstTotalProjectdayTypeObject->AddItem('15 Days','3');
		$this->lstTotalProjectdayTypeObject->AddItem('15 Days','4');
		$this->lstTotalProjectdayTypeObject->AddItem('30 Days','5');
		$this->lstTotalProjectdayTypeObject->AddItem('40 Days','6');
		$this->lstTotalProjectdayTypeObject->AddItem('60 Days','7');
			

		return $this->lstTotalProjectdayTypeObject;
	}

	public function chkAgreementCheck_Create($strControlId = null) {
		$this->chkAgreementCheck = new QCheckBox($this);
		$this->chkAgreementCheck->Name = QApplication::Translate('Agreement Check');

		return $this->chkAgreementCheck;
	}

	public function chkHideSearchEngine_Create($strControlId = null) {
		$this->chkHideSearchEngine = new QCheckBox($this);
		$this->chkHideSearchEngine->Name = QApplication::Translate('Hide Search Engine');
		return $this->chkHideSearchEngine;
	}
	

	protected function add_html_contents($text_)
	{
		$this->contents_html=$this->contents_html.'<br />'.$text_;
	}

	 

	public function render_contents_area() {

		//$this->contents_html=$this->contents_html.$this->bool_my_project();

		if($this->bool_contents_area_on)
		{

			echo(" ");
			echo($this->contents_html);
		}
	}
	 



	public function render_cph_left_begin()
	{
		echo("<div class='cph left'>");
	}
	public function render_div_end()
	{
		echo("</div>");
	}
	public function render_fieldset_begin()
	{
		echo ("<fieldset>");
	}
	public function render_fieldset_end()
	{
		echo ("</fieldset>");
	}
	public function render_floatleft_w500_begin()
	{
		echo("<div class='floatLeft w500'>");
	}

	public function render_floatleft_w400_begin()
	{
		echo("<div class='floatLeft w400'>");
	}
	public function render_floatleft_w200_begin()
	{
		echo("<div class='floatLeft w200'>");
	}

	public function render_content_place_holder()
	{
		echo ("<div class='cph left w950 h5'></div>");
		echo ("<div class='contentPlaceholder'>");
		echo ("<div class='contentPlaceholder_center' align='center' style='border:0px solid #000000; margin:auto\>");
		echo ("<div class='w955 mrgTop10 padLeft15'>");
	}
	public function render_project_sitemap_link()
	{
		if($this->bool_logined())
		{	echo("<div class='cph breadcrumb'>");
		echo("<a href='index.php' >Projects</a> >> New Project");
		echo("</div>");
		}
	}
	public function render_project_steps_text()
	{
		if ($this->bool_confirming==1) {
		echo("<div class='cph center'>");
		echo("<div style='width:70px; height:20px;float:left;'></div>");
		echo("<div class='headingBox headingBox_selected pointer'>");
		echo("Step 1. Please input the form.");
		echo("</div>");
		echo("<div class='headingBox headingBox_unfilled' style='border-left:0px'>");
		echo("Step 2. Please confirm your input and submit.");
		echo("</div>");
		echo("<div class='headingBox headingBox_unfilled' style='border-left:0px'>");
		echo("Step 3. Posting a new project is completed.");
		echo("</div>");
		echo("</div>");
		}
		elseif ($this->bool_confirming==2)
		{
		echo("<div class='cph center'>");
		echo("<div style='width:70px; height:20px;float:left;'></div>");
		echo("<div class='headingBox headingBox_unfilled'>");
		echo("Step 1. Please input the form.");
		echo("</div>");
		echo("<div class='headingBox headingBox_selected pointer' style='border-left:0px'>");
		echo("Step 2. Please confirm your input and submit.");
		echo("</div>");
		echo("<div class='headingBox headingBox_unfilled' style='border-left:0px'>");
		echo("Step 3. Posting a new project is completed.");
		echo("</div>");
		echo("</div>");
		}
		else 
		{
		echo("<div class='cph center'>");
		echo("<div style='width:70px; height:20px;float:left;'></div>");
		echo("<div class='headingBox headingBox_unfilled'>");
		echo("Step 1. Please input the form.");
		echo("</div>");
		echo("<div class='headingBox headingBox_unfilled' style='border-left:0px'>");
		echo("Step 2. Please confirm your input and submit.");
		echo("</div>");
		echo("<div class='headingBox headingBox_selected pointer' style='border-left:0px'>");
		echo("Step 3. Posting a new project is completed.");
		echo("</div>");
		echo("</div>");
		}
		
	}
	
	public function render_posting_advice_text()
	{
		if ($this->bool_confirming==1) {
			
		
		$this->render_cph_left_begin();
		echo("Please make sure you only post projects that is possible to bid on. You have to make sure your description is clear enough. Service providers must be able to estimate a price based on your project description.");
		$this->render_div_end();
		}
	}
	 
	public function render_denote_text()
	{
		if ($this->bool_confirming==1) {
		echo("<div class='cph red'>");
		echo("	* - denotes required fields.");
		echo("</div>");
		}
	}
	public function render_permission_error_text()
	{
		if ($this->bool_confirming==1) {
		if($this->bool_permitted==true)
		{
			echo ("<div class='cph error red'>");
			echo("	<img height='30' src='".__IMAGE_ASSETS__."/error_icon.png' alt='error' align='left' style='margin-right: 20px' />");
			
			$this->render_message_text();
			 
			echo("</div>");

		}
		elseif ($this->bool_permitted==false)
		{
			 
		}

	}
	}
	public function render_cph_w950_h5()
	{
		echo ("<div class='cph w950 h5'></div>");
	}
	public function render_title_box()
	{
if ($this->bool_confirming==1) {
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo("<legend class='bold'>1. Please input a title for your project <span class='red'>*</span></legend>");
		$this->render_floatleft_w500_begin();
		$this->txtTitle->RenderWithError('CssClass=input w300','MaxLength=50');
		echo("(Max 50 characters.");
		$this->render_div_end();
		$this->render_floatleft_w400_begin();
		echo("This title will be shown in the project list. Clear title will help providers to understand the project.");
		$this->render_div_end();
		$this->render_fieldset_end();
		$this->render_div_end();
}
		 
	}
	public function render_main_category_list()
	{
		echo ("<select class='input w175' id='maingroup' name='maingroup' multiple='multiple' size='8' onchange='selectSub(this)'>");
		echo("<option value='0'>Design</option>");
		echo("<option value='1'>Software</option>");
		echo("<option value='2'>Design &amp; Software</option>");
		echo("<option value='3'>Management &amp; Support</option>");
		echo("<option value='4'>Writing &amp; Translation </option>");

		echo("<option value='5'>Sound &amp; Multimedia</option>");
		echo("<option value='6'>Leagal &amp; Accounting </option>");
		echo("<option value='7'>Partnership  &amp; Marketing</option>");
		echo("</select>");

	}
	 
	public function render_main_subcategory_list()
	{
		echo ("	<select class='input w175' id='subgroup' name='subgroup' multiple='multiple' size='8'>");

		echo("<option value='0'>Web</option>");
		echo("<option value='1'>Graphics</option>");
		echo("<option value='2/Icon/Banners'>Logo/Icon/Banners</option>");
		echo("<option value='3'>Character</option>");
		echo("<option value='4'>Concept/Interface</option>");
		echo("<option value='5'>3D</option>");
		echo("<option value='6'>Other</option>");
		echo("</select>");

	}
	public function render_category_box()
	{
		if ($this->bool_confirming==1) {
		$this->render_cph_w950_h5();
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo ("<legend class='bold'>2. Please select your categories for your project. <span class='red'>*</span></legend>");
		$this->render_floatleft_w200_begin();
		echo ("Please select a main category.");
		$this->render_div_end();
		$this->render_floatleft_w200_begin();
		$this->render_main_category_list();
		$this->render_div_end();
		echo ("<div class='floatLeft w200' id='sub1'>");
		echo ("Please select a sub category.");
		$this->render_div_end();
		echo ("<div class='floatLeft w200' style='visibility:hidden' id='sub2'>");
		$this->render_main_subcategory_list();
		$this->render_div_end();
		$this->render_fieldset_end();
		$this->render_div_end();
		}

	}

	public function render_select_project_type()
	{
		if ($this->bool_confirming==1) {
		echo("<div class='cph w950 h5'></div>");
		echo("<div class='cph left'>");
		echo("  <fieldset>");
		echo("<legend class='bold'>2. Please select a type for your project <span class='ed'>*</span></legend>");
		echo("<div class='floatLeft w150'>");
		$this->lstProjectTypeObject->RenderWithError('FontSize=12px','Width=300px');
		echo("	<div class='floatLeft w175'>");
		echo("</div>");
		echo("<div class='floatLeft w500'>");
		echo("	Spec based project means the project will have a cocrete specification to complete. <br />
				Long term project means the projected will be repeated with a required cycle.");
		$this->render_help_button();
		$this->render_div_end();
		$this->render_div_end();
		}

		 
	}
	public function render_project_description_box()
	{
		if ($this->bool_confirming==1) {
		
		$this->render_cph_w950_h5();
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo("<legend class='bold'>4. Please describe a project in detail.<span class='red'>*</span></legend>");
		echo ("	<div class='floatLeft w610'>");
		$this->txtDescription->RenderWithError();
		$this->render_div_end();
		echo ("<div class='floatRight w300'>");
		echo("	Please add as much information as much possible about your project. Service providers will bid based on your description.");
		$this->render_div_end();
		echo ("	<div style='margin-top:225px;'>");
		echo ("( max 10000 characters. ** Left )");
		$this->render_div_end();
		echo (" <div class='padTLB' style='float:left'>");
		echo ("You can not post any spam, contact information or advertisement.");
		$this->render_div_end();
		$this->render_fieldset_end();
		$this->render_div_end();
		}

		 
	}
	
	public  function render_upload_box()
	{
		 
if ($this->bool_confirming==1) {
		echo("<div class='cph left'>");
		$this->render_fieldset_begin();
		echo("<legend class='bold'>5. You can upload files that are relavent to the project.</legend>");
		echo("<div class='floatLeft w500'>");
		$this->container->RenderWithName();
		$this->btnMore->Render();
		$this->btnAll->Render();
		$this->render_div_end();
		echo("<div class='floatLeft w400'>");
		echo("Please archieve your files in to a file. Zip format is recommended. You can also delete the file after the project is started.");
		$this->render_div_end();
		$this->render_help_button();
}
	}

	public function render_project_budget()
	{
		if ($this->bool_confirming==1) {
		$this->render_cph_w950_h5();
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo ("	<legend class='bold'>6. Please select a budget range for your project. <span class='red'>*</span></legend>");
		echo ("	<div class='floatLeft w115'>");
		$this->lstBudgetTypeObject->Render('CssClass=floatLeft w115','FontSize=12px','Width=900px');
		$this->render_div_end();
		$this->render_fieldset_end();
		$this->render_div_end();
		}

	}
	public  function render_project_days_complete_box()
	{
		if ($this->bool_confirming==1) {
		$this->render_cph_w950_h5();
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo ("	<legend class='bold'>7. How many days should this project stay open for bidding? <span class='red'>*</span></legend>");
		echo ("<div class='floatLeft w75'>");
		$this->lstTotalProjectdayTypeObject->RenderWithError('CssClass=floatLeft w75','FontSize=12px','Width=900px');
		$this->render_div_end();
		$this->render_fieldset_end();
		$this->render_div_end();
		}

	}
	public function render_chkSearchEngineHide_box()
	{
		if ($this->bool_confirming==1) {
		$this->render_cph_w950_h5();
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo ("<legend class='bold'>8. Do you use an option to hide project details from search engines and not registered users ($3 cost). To view bid you must login.</legend>");
		echo ("<div class='floatLeft'>");
		$this->chkHideSearchEngine->RenderWithError();
		echo (" I want to hide project details from search engines and not registered user ($3 cost)");
		$this->render_div_end();
		$this->render_help_button();
		}
			
			
	}
	public  function render_agree_chkbox()
	{
		if ($this->bool_confirming==1) {
		echo ("<div class='cph'>");
		$this->chkAgreementCheck->RenderWithError();
		echo (" I agree the <a href='terms_of_use.html'>terms of use </a>");
		echo ("<img src='".__IMAGE_ASSETS__."/popup_small.gif' alt='' border='0' align='absmiddle'  />");
		echo  ("</div>");
		}
	}
	
	public function render_w600()
	{
		echo("<div class='w600'>");
	}
	public function render_float_w148_row1_style1()
	{
		echo("<div class='floatLeft w148  altBgColor1'>");
	}
 	public function render_float_w148_row2_style1()
 	{
 	echo("<div class='floatLeft w448 altBgColor1 borderLeft'>");
 	}
	public  function render_float_w148_row1_style2()
	{
	echo ("<div class='floatLeft w148 altBgColor2'>");
	}
	public function render_float_w148_row2_style2()
	{
		echo("<div class='floatLeft w448 altBgColor2 borderLeft'>");
	}	
	
	public function render_confirmation_box()
	{
		if ($this->bool_confirming==2) {
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo("<legend class='bold'>Please the project details and submit to post this project.<span class='red'></span></legend>");
		echo("<div class='floatLeft w150'></div>");
		
		echo ("<div class='floatLeft w600 border pad0'>");
		
		$this->render_title_confirmation_box();
		$this->render_Categoty_confirmation_box();
		$this->render_Budget_confirmation_box();
		$this->render_project_created();
		$this->render_Bidding_Ends_confirmation_box();
		$this->render_Project_Creator_box();
		$this->render_Description_box();
		$this->render_Job_Type_box();
		$this->render_div_end();
		$this->render_fieldset_end();
		$this->render_div_end();
		$this->render_fieldset_end();
		echo("<div class='cph leftt'>");
		echo ("Posting a project is free, but we charge a refundable fee of $5 if you post a regular (non-featuerd) project.<br/> This fee will automatically refunded when you award the project to a specific service provider or cancel it.");
		$this->render_div_end();
		
		echo ("<div class='cph leftt'>");
		echo ("The following fee will be charged:<br /><br />
			&nbsp; &nbsp; &nbsp; &nbsp; &bull; Refundable project fee	$5.00<br /><br />");
		echo ("<span class='bold'>Total: $5.00</span>");
			$this->render_div_end();
			$this->render_div_end();
		
			echo ("	<div class='cph left w950 h5'></div>");
		}
	}
	public function render_posted_project_box()
	{
		if ($this->bool_confirming==3) {
		$this->render_cph_left_begin();
		$this->render_fieldset_begin();
		echo("<legend class='bold'>Please the project details and submit to post this project.<span class='red'></span></legend>");
		echo("<div class='floatLeft w150'></div>");
		
		echo ("<div class='floatLeft w600 border pad0'>");
		
		$this->render_title_confirmation_box();
		$this->render_Categoty_confirmation_box();
		$this->render_Budget_confirmation_box();
		$this->render_project_created();
		$this->render_Bidding_Ends_confirmation_box();
		$this->render_Project_Creator_box();
		$this->render_Description_box();
		$this->render_Job_Type_box();
		$this->render_div_end();
		$this->render_fieldset_end();
		$this->render_div_end();
		$this->render_fieldset_end();
		echo("<div class='cph leftt'>");
		echo ("You have submitted the project successfully. It will take a few seconds or minute for our system to publish your project.");
		$this->render_div_end();
		
		echo ("<div class='cph leftt'>");
		echo (" &nbsp; &nbsp; &nbsp; &nbsp; &bull; Refundable project fee $5.00 was charged.<br /><br />
		 Please check the transaction from the <a href='#'>transaction page</a> in your account panel.");
		echo ("<span class='bold'>Total: $5.00</span>");
			$this->render_div_end();
			$this->render_div_end();
		
			echo ("	<div class='cph left w950 h5'></div>");
		}
	}
	
	
	
	
	public function render_buttons_submit_begin()
	{
if ($this->bool_confirming==2) {
		$this->render_cph_left_begin();
			echo ("<div class='floatLeft w300'></div>");
			echo ("<div class='floatLeft'>");
			echo ("<span class='button'>");
}
	}
public function render_buttons_Postproject()
	{
if ($this->bool_confirming==3) {
		$this->render_cph_left_begin();
			echo ("<div class='floatLeft w300'></div>");
			echo ("<div class='floatLeft'>");
			echo ("<span class='button'>");
}
					
		
	}
	public function render_button_submit_end()
	{
		
if ($this->bool_confirming==2) {
			echo ("</span>");
			$this->render_div_end();
			echo ("	<div class='floatLeft w50'></div>");
			echo ("<div class='floatLeft'>");
			echo ("<span class='button'>");
			//echo ("<span class='button'><button type='button' name='foo' value='Confirm' onclick='window.location.href='new_project_3.html'>Submit Project</button></span>");
}
	}
	public function render_title_confirmation_box()
	{
		//$this->render_w600();
		echo("<div class='floatLeft w148 bold tblBgColor'>");
		echo("Project Title");
		$this->render_div_end();
			echo("<div class='floatLeft w448 bold tblBgColor borderLeft'>");
		echo ($this->txtTitle->Text);
		$this->render_div_end();
		
	 
		
	}
	public function render_Categoty_confirmation_box()
	{
		//$this->render_w600();
		$this->render_float_w148_row1_style2();
		echo("Categoty");
		$this->render_div_end();
		$this->render_float_w148_row2_style2();
		//$this->categoryid=$_POST['maingroup'];
		
		switch ($this->categoryid){
		case 0:
			echo ("Desgin");
			break;
		case 1:
			echo ("Software");
			break;
		case 2:
			echo ("Design &amp; Software");
			break;
		case 3:
			echo ("Management &amp; Support");
			break;
		case 4:
			echo ("Writing &amp; Translation");
			break;
		case 5:
			echo ("Sound &amp; Multimedia");
			break;
		case 6:
			echo ("Leagal &amp; Accounting");
			break;
		case 7:
			echo ("Partnership  &amp; Marketing");
			break;
		}

			
		$this->render_div_end();
		
		
	}
		public function render_Budget_confirmation_box()
	{
		//$this->render_w600();
		$this->render_float_w148_row1_style1();
		echo("Budget");
		$this->render_div_end();
		$this->render_float_w148_row2_style1();
		echo($this->lstBudgetTypeObject->SelectedName);
		$this->render_div_end();
	
		
	}  
	public function render_project_created()
	{
		
		$this->render_float_w148_row1_style2();
		echo("Created");
		$this->render_div_end();
		$this->render_float_w148_row2_style2();
		echo(QDateTime::Now());
		$this->render_div_end();
	}
	
		public function render_Bidding_Ends_confirmation_box()
	{
		//$this->render_w600();
		$this->render_float_w148_row1_style1();
		echo("Bidding Ends");
		$this->render_div_end();
		$this->render_float_w148_row2_style1();
		echo("");
		$this->render_div_end();
		
		
	}
	public function render_Project_Creator_box()
	{
		
		//$this->render_w600();
		$this->render_float_w148_row1_style2();
		echo("Project_Creator");
		$this->render_div_end();
		$this->render_float_w148_row2_style2();
		echo(         $_SESSION['Username']);
		$this->render_div_end();
		
	}
	public function render_Description_box()
	{
		//$this->render_w600();
		$this->render_float_w148_row1_style1();
		echo("Description");
		$this->render_div_end();
		$this->render_float_w148_row2_style1();
		echo($this->txtDescription->Text);
		$this->render_div_end();
		
		
		
	}
	public function render_Job_Type_box()
	{
		$this->render_w600();
		$this->render_float_w148_row1_style2();
		echo("Job Type");
		$this->render_div_end();
		$this->render_float_w148_row2_style2();
		echo($this->lstProjectTypeObject->SelectedValue);
		$this->render_div_end();
			
	}
	
	public function render_confirmButton_begin_tags()
	{
			if ($this->bool_confirming==1) {
		echo("<div class='cph center'>");
		echo ("<div class='floatLeft w450'></div>");
	echo ("<div class='floatLeft'><span class='button'>");
			}
	}
	public function render_confirmationButton_end_tags()
	{
			if ($this->bool_confirming==1) {
		echo("</span></div></div>");
			}
	}
	




	public function render_help_button()
	{
		echo ("<div class='floatRight w50 help'>");
		echo ("<a href='#' title='Help'>Help</a>  <img src='".__IMAGE_ASSETS__."/popup_small.gif' alt='' border='0' align='absmiddle' />");
		$this->render_div_end();

		 
		$this->render_fieldset_end();
		$this->render_div_end();
	}
	  public function btnBackStep_Click($strFormId, $strControlId, $strParameter) {
            $this->bool_confirming=1;
            $this->bool_message_exist=false;
            $this->btnSave->Visible=true;
        }
        
     
         public function btnSubmitProject_Click($strFormId, $strControlId, $strParameter) {
            
         	$this->bool_confirming=3;
            $this->bool_message_exist=false;
            $this->btnSave->Visible=false;
            $this->btnBackStep->Visible=false;
            $this->btnSubmitProject->Visible=false;
             $objUser = unserialize($_SESSION['User']);
            
            $objUser->Id;
             //save data
            $this->project=new TableProject();
            $this->project->CategoryId=$this->categoryid;
            $this->project->SubcategoryId=$this->subcategoryid;
            $this->project->Title=$this->txtTitle->Text;
            $this->project->Description=$this->txtDescription->Text;
            $this->project->BudgetMin=$this->lstBudgetTypeObject->SelectedValue;
            $this->project->PostDate=QDateTime::Now();
            $this->project->UserId=$objUser->Id;
          	$this->project->Save();
            

         
         }
           public function btnProjectPage_Click($strFormId, $strControlId, $strParameter) {
            
         	$this->bool_confirming=3;
            $this->bool_message_exist=false;
            $this->btnSave->Visible=false;
            $this->btnBackStep->Visible=false;
            $this->btnSubmitProject->Visible=false;
            $objUser = unserialize($_SESSION['User']);
            
            
            /*$objUser->Id;
             //save data
            $this->project=new TableProject();
            $this->project->CategoryId=$this->categoryid;
            $this->project->SubcategoryId=$this->subcategoryid;
            $this->project->Title=$this->txtTitle->Text;
            $this->project->Description=$this->txtDescription->Text;
            $this->project->BudgetMin=$this->lstBudgetTypeObject-SelectedValue;
            $this->project->PostDate=QDateTime::Now();
            $this->project->$objUser->Id;
            copy($this->tmp->File, __ProjectFileUpload__.'/'. $this->tmp->FileName);
           echo  $this->project->Os=$this->tmp->File;
            //$this->project->Save();*/
			
            
         
         }


	
	public function bool_qcontrol_text_input_ok($qcontrol_) {

		if(isset($qcontrol_))
		{
			if (!($qcontrol_ instanceof QTextBoxBase))return false;

			if(strlen(trim($qcontrol_->Text))>0)
			{
				$qcontrol_->Text=trim($qcontrol_->Text);
				return true;
			}
		}
		return false;
	}
	public function bool_qcontrol_radiobutton_validate($qcontrol_) {

		if(isset($qcontrol_))
		{
			if (!($qcontrol_ instanceof QTextBoxBase))return false;

			if(strlen(trim($qcontrol_->Text))>0)
			{
				$qcontrol_->Text=trim($qcontrol_->Text);
				return true;
			}
		}
		return false;
	}
	


	public function btnSave_Click($strFormId, $strControlId, $strParameter) {
		 $this->bool_error=false;
		
		$this->validate_txtbox();
		$this->validate_projecttype();
		$this->validate_txtDescription();
		$this->validate_lstBudgetType();
		$this->validate_lstTotalProjectDay();
		$this->validate_chkagreement();
		
		 if(!$this->bool_error)
            {
			
		$this->bool_confirming=2;
		$this->btnSave->Visible=false;
		 $this->bool_message_exist=false;
		 	$this->categoryid=$_POST['maingroup'];
		 		$this->subcategoryid=$_POST['subgroup'];
		 	
		
		 
		}
		 else
            {
            		$this->btnSave->Visible=true;
                $this->bool_message_exist=true;
            }
		
	}
	public function set_error_message($str_) {

            if(!$this->bool_error)
            {
                $this->reset_message();
                $this->append_line_message($str_);
                $this->bool_error=true;
            }
        }
         public function reset_message() {

            $this->str_message='';
        }
         public function append_line_message($str_) {

            $this->append_message($str_.'<br />');
        }
         public function append_message($str_) {

            $this->str_message.=$str_;
        }
        
        public function reset_error_message() {
            $this->reset_message();
            $this->bool_error=false;
            $this->bool_message_exist=false;
        }
       public function render_message_text() {

            if($this->bool_message_exist)
            {
                echo($this->str_message);
            }
        }
	
	public function validate_txtbox(){	
	
		if(!$this->bool_qcontrol_text_input_ok($this->txtTitle))
		{
			

			$this->txtTitle->Blink();
			$this->set_error_message('Please input your Title of the Project');
		
			
		}
		
		
	}
	public function validate_projecttype(){	
	
		if($this->lstProjectTypeObject->SelectedIndex == -1)
		{
			

			$this->lstProjectTypeObject->Blink();
			
			$this->set_error_message('Please Project Type');
		
		}
	
	}
	public function validate_txtDescription(){	
		if(!$this->bool_qcontrol_text_input_ok($this->txtDescription))
		{
			

			$this->txtDescription->Blink();
			
			$this->set_error_message('Please input description');
		
		}
		
	}
public function validate_lstBudgetType(){	
		if($this->lstBudgetTypeObject->SelectedIndex == -1)
		{
		

			$this->lstBudgetTypeObject->Blink();
		
				$this->set_error_message('Please input  Budget Type');
			
		}
		
}
public function validate_lstTotalProjectDay(){	
		if($this->lstTotalProjectdayTypeObject->SelectedIndex == -1)
		{
			

			$this->lstTotalProjectdayTypeObject->Blink();
			
			$this->set_error_message('Please input project Completetion day');
		
		}
		
}
public function validate_chkagreement(){	
		if($this->chkAgreementCheck->Checked == null)
		{
		

			$this->chkAgreementCheck->Blink();
						$this->set_error_message('You have not agree to the terms and conditions');
			
			
		}
		
		




	}




}

newProject::Run('newProject','newProject.tpl.php');

?>
